package com.huawei.esdk.tp.common.local;

import com.huawei.esdk.tp.common.local.authentication.AuthorizeService;
import com.huawei.esdk.tp.common.local.conference.ConferenceService;
import com.huawei.esdk.tp.common.local.impl.service.AuthorizeServiceImpl;
import com.huawei.esdk.tp.common.local.impl.service.ConferenceServiceImpl;
import com.huawei.esdk.tp.common.local.impl.service.SiteServiceImpl;
import com.huawei.esdk.tp.common.local.site.SiteService;

public class ServiceFactory
{
	static
	{
		System.setProperty("org.apache.cxf.JDKBugHacks.defaultUsesCaches", "true");
	}
    @SuppressWarnings("unchecked")
    public static <T> T getService(Class<? extends T> interfaceClass)
    {
        if (interfaceClass.getName().equals(ConferenceService.class.getName()))
        {
            return (T) ConferenceServiceImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(SiteService.class.getName()))
        {
            return (T)SiteServiceImpl.getInstance();
        }
        else if (interfaceClass.getName().equals(AuthorizeService.class.getName()))
        {
            return (T)AuthorizeServiceImpl.getInstance();
        }
   
        return null;
    }

}
